{include file="header.html"}
<script type="text/javascript" src="{lib file=ajax_tree.js}" charset="utf-8"></script>
<div id="rightTop">
    <p>{$lang.gcategory}</p>
    <ul class="subnav">
        <li><span>{$lang.manage}</span></li>
        <li><a class="btn1" href="index.php?app=gcategory&amp;act=add">{$lang.add}</a></li>
        <li><a class="btn1" href="index.php?app=gcategory&amp;act=export">{$lang.export}</a></li>
        <li><a class="btn1" href="index.php?app=gcategory&amp;act=import">{$lang.import}</a></li>
    </ul>
</div>

<div class="info2">
    <table  class="distinction">
        <!--{if $gcategories}-->
        <thead>
        <tr class="tatr1">
            <td class="w30"><input id="checkall_1" type="checkbox" class="checkall" /></td>
            <td width="50%"><span class="all_checkbox"><label for="checkall_1">{$lang.checkall}</label></span>{$lang.cate_name}</td>
            <td>{$lang.sort_order}</td>
            <td>{$lang.gcategory_type}</td>
            <td>{$lang.is_recommend}</td>
            <td>{$lang.if_show}</td>
            <th>图标</th>
            <td class="handler">{$lang.handler}</td>
        </tr>
        </thead>
        <!--{/if}-->
        <!-- {if $gcategories} --><tbody id="treet1"><!-- {/if} -->
        <!--{foreach from=$gcategories item=gcategory}-->
        <tr>
            <td class="align_center w30"><input type="checkbox" class="checkitem" value="{$gcategory.cate_id}" /></td>
            <td class="node" width="50%"><!--{if $gcategory.switchs}--><img src="templates/style/images/treetable/tv-expandable.gif" ectype="flex" status="open" fieldid="{$gcategory.cate_id}"><!--{else}--><img src="templates/style/images/treetable/tv-item.gif"><!--{/if}--><span class="node_name editable" ectype="inline_edit" fieldname="cate_name" fieldid="{$gcategory.cate_id}" required="1" title="{$lang.editable}">{$gcategory.cate_name|escape}</span></td>
            <td class="align_center"><span class="editable" ectype="inline_edit" fieldname="sort_order" fieldid="{$gcategory.cate_id}" datatype="number" title="{$lang.editable}">{$gcategory.sort_order}</span></td>
            <td class="align_center"><span>{$gcategory_type.$gcategory.type_id}</span></td>
            <td class="align_center"><!--{if $gcategory.is_recommend}--><img src="templates/style/images/positive_enabled.gif" ectype="inline_edit" fieldname="is_recommend" fieldid="{$gcategory.cate_id}" fieldvalue="1" title="{$lang.editable}"/><!--{else}--><img src="templates/style/images/positive_disabled.gif" ectype="inline_edit" fieldname="is_recommend" fieldid="{$gcategory.cate_id}" fieldvalue="0" title="{$lang.editable}"/><!--{/if}--></td>
            <td class="align_center"><!--{if $gcategory.if_show}--><img src="templates/style/images/positive_enabled.gif" ectype="inline_edit" fieldname="if_show" fieldid="{$gcategory.cate_id}" fieldvalue="1" title="{$lang.editable}"/><!--{else}--><img src="templates/style/images/positive_disabled.gif" ectype="inline_edit" fieldname="if_show" fieldid="{$gcategory.cate_id}" fieldvalue="0" title="{$lang.editable}"/><!--{/if}--></td>           
            <td class="align_center">{if $gcategory.logo}<img src="{$gcategory.logo}" width="40" height="30" />{/if}</td>
            <td class="handler"><span><a href="index.php?app=gcategory&amp;act=edit&amp;id={$gcategory.cate_id}">{$lang.edit}</a>
                |
                <a href="javascript:if(confirm('{$lang.drop_confirm}'))window.location = 'index.php?app=gcategory&amp;act=drop&amp;id={$gcategory.cate_id}';">{$lang.drop}</a><!-- {if $region.layer lt $max_layer} --> | <a href="index.php?app=gcategory&amp;act=add&amp;pid={$gcategory.cate_id}">{$lang.add_child}</a><!-- {/if} -->
                |
                <a href="javascript:void(0)" class="feature_btn mgt5" cate_id="{$gcategory.cate_id}" store_text="{$gcategory.store_text}">推荐店铺</a> <!--| <a style="color:#f30" href="index.php?app=attribute&amp;cid={$gcategory.cate_id}">属性设置</a> | <a style="color:#f30" href="index.php?app=spec&amp;cid={$gcategory.cate_id}">规格设置</a>-->
                </span>
                </td>
        </tr>
        <!--{foreachelse}-->
        <tr class="no_data">
            <td colspan="6">{$lang.no_data}</td>
        </tr>
        <!--{/foreach}-->
        <!-- {if $gcategories} --></tbody><!-- {/if} -->
        <tfoot>
            <tr class="tr_pt10">
            <!-- {if $gcategory} -->
                <td class="align_center"><label for="checkall1"><input id="checkall_2" type="checkbox" class="checkall"></label></td>
                <td colspan="6" id="batchAction">
                    <span class="all_checkbox"><label for="checkall_2">{$lang.checkall}</label></span>&nbsp;&nbsp;
                    <input class="formbtn batchButton" type="button" value="{$lang.drop}" name="id" uri="index.php?app=gcategory&act=drop" presubmit="confirm('{$lang.drop_confirm}');" />
                    <input class="formbtn batchButton" type="button" value="{$lang.edit}" name="id" uri="index.php?app=gcategory&act=batch_edit" />
                    <!--<input class="formbtn batchButton" type="button" value="lang.update_order" name="id" presubmit="updateOrder(this);" />-->
                </td>
            <!--{/if}-->
            </tr>
        </tfoot>
    </table>
</div>
<div class="feature-wrap" id="feature_wrap"></div>
<script type="text/html" id="feature_cont">
    <h2>推荐店铺</h2>
    <a href="javascript:void(0)" class="close_btn">X</a>
    <form action="" method="post">
        <table class="infoTable">
            <tr>
                <td width="70" height="40"> 店铺URL：</td>
                <td>
                    <textarea style="height: 200px;" name="store_text" id="store_text"></textarea>
                </td>
            </tr>
            <tr>
                <td height="20" colspan="2">店铺链接、或添入店铺的id，id之间可用任意字符分割，如:1,2,3</td>
            </tr>
            <tr>
                <td align="right" height="50">&nbsp;</td>
                <td>
                    <input class="formbtn mgr10" type="submit" id="feature_submit" name="Submit" value="提交" />
                    <input class="formbtn" type="reset" name="reset" value="重置" />
                </td>
            </tr>
        </table>
    </form>
</script>
<script type="text/javascript">
    $(function(){
        var html=$('#feature_cont').html();
        jQuery.each($('.feature_btn'),function(){
            $(this).bind('click',function(){
                var cate_id=$(this).attr('cate_id');
                var store_str=$(this).attr('store_text');
                var $this=$(this);
                $('#feature_wrap').html(html);
                $('#feature_wrap').find('#store_text').val(store_str);
                jQuery('#feature_wrap').children('.close_btn').bind('click',function(){
                    admin.hidePop({'id':'#feature_wrap'});
                });
                jQuery('#feature_wrap').children('form').submit(function(){
                    var store_text = $('#store_text').val();
                    $.get('index.php?app=gcategory&act=ajax_recommend_store'+'&cate_id='+cate_id+'&store_text='+store_text,function(data){
                        admin.hidePop({'id':'#feature_wrap'});
                        var jdata=eval('('+data+')');
                        if(jdata.done){
                            //$this.hide();
                        }else{
                            admin.sConfirm({'info':jdata.msg,'cancel':true});
                        }
                    },'json');
                    return false;
                });
                admin.showPop({'id':'#feature_wrap','maxWrap':document});

            });
        });
    });
</script>
{include file="footer.html"}